<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="input1">
    <input type="text" id="input2">
    <button id="send">发送</button>
</body>
<script>
    const btn = document.getElementById('send')
    const input1 = document.getElementById('input1')
    const input2 = document.getElementById('input2')

    btn.onclick = function() {
        if(input1.value.trim() && input2.value.trim()) {
            localStorage.setItem('msg1', input1.value.trim())
            localStorage.setItem('msg2', input2.value.trim())
        }
    }
</script>
</html>